package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2021-03-03
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_alipay_user_info")
@ApiModel(value = "AlipayUserInfo", description = "")
@AllArgsConstructor
public class AlipayUserInfo extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 用户支付宝 ID
     */
    @ApiModelProperty(value = "用户支付宝 ID")
    @Length(max = 20, message = "用户支付宝 ID长度不能超过20")
    @TableField(value = "user_id", condition = LIKE)
    @Excel(name = "用户支付宝 ID")
    private String userId;

    /**
     * 访问令牌
     */
    @ApiModelProperty(value = "访问令牌")
    @Length(max = 255, message = "访问令牌长度不能超过255")
    @TableField(value = "access_token", condition = LIKE)
    @Excel(name = "访问令牌")
    private String accessToken;

    /**
     * 访问令牌的有效时间
     */
    @ApiModelProperty(value = "访问令牌的有效时间")
    @Length(max = 255, message = "访问令牌的有效时间长度不能超过255")
    @TableField(value = "expires_in", condition = LIKE)
    @Excel(name = "访问令牌的有效时间")
    private String expiresIn;

    /**
     * 刷新令牌
     */
    @ApiModelProperty(value = "刷新令牌")
    @Length(max = 255, message = "刷新令牌长度不能超过255")
    @TableField(value = "refresh_token", condition = LIKE)
    @Excel(name = "刷新令牌")
    private String refreshToken;

    /**
     * 刷新令牌的有效时间
     */
    @ApiModelProperty(value = "刷新令牌的有效时间")
    @Length(max = 255, message = "刷新令牌的有效时间长度不能超过255")
    @TableField(value = "re_expires_in", condition = LIKE)
    @Excel(name = "刷新令牌的有效时间")
    private String reExpiresIn;

    /**
     * 用户头像地址
     */
    @ApiModelProperty(value = "用户头像地址")
    @Length(max = 255, message = "用户头像地址长度不能超过255")
    @TableField(value = "avatar", condition = LIKE)
    @Excel(name = "用户头像地址")
    private String avatar;

    /**
     * 省份名称
     */
    @ApiModelProperty(value = "省份名称")
    @Length(max = 255, message = "省份名称长度不能超过255")
    @TableField(value = "province", condition = LIKE)
    @Excel(name = "省份名称")
    private String province;

    /**
     * 市名称
     */
    @ApiModelProperty(value = "市名称")
    @Length(max = 255, message = "市名称长度不能超过255")
    @TableField(value = "city", condition = LIKE)
    @Excel(name = "市名称")
    private String city;

    /**
     * 用户昵称
     */
    @ApiModelProperty(value = "用户昵称")
    @Length(max = 255, message = "用户昵称长度不能超过255")
    @TableField(value = "nick_name", condition = LIKE)
    @Excel(name = "用户昵称")
    private String nickName;

    /**
     * 性别
     */
    @ApiModelProperty(value = "性别")
    @Length(max = 255, message = "性别长度不能超过255")
    @TableField(value = "gender", condition = LIKE)
    @Excel(name = "性别")
    private String gender;


    @Builder
    public AlipayUserInfo(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long updateUser, Long createUser, 
                    String userId, String accessToken, String expiresIn, String refreshToken, String reExpiresIn, 
                    String avatar, String province, String city, String nickName, String gender) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createUser = createUser;
        this.userId = userId;
        this.accessToken = accessToken;
        this.expiresIn = expiresIn;
        this.refreshToken = refreshToken;
        this.reExpiresIn = reExpiresIn;
        this.avatar = avatar;
        this.province = province;
        this.city = city;
        this.nickName = nickName;
        this.gender = gender;
    }

}
